/**
 * Package:com.goldcity.codec;
 * $Id: BinaryCodecFactory.java,v 1.1 2009/03/20 08:34:35 yangc Exp $
 * Copyright(c) 2001-2005 www.afteryuan.com
 */
package com.afteryuan.server.mina;

import org.apache.mina.filter.codec.ProtocolCodecFactory;
import org.apache.mina.filter.codec.ProtocolEncoder;
import org.apache.mina.filter.codec.ProtocolDecoder;
import org.apache.mina.filter.codec.textline.LineDelimiter;
import org.apache.mina.core.session.IoSession;
import org.apache.commons.codec.BinaryEncoder;

import java.nio.charset.Charset;

import com.afteryuan.server.mina.codec.Amf3Encoder;
import com.afteryuan.server.mina.codec.Amf3Decoder;

/**
 * BinaryCodecFactory类 协议编码解码器工厂类
 * 为传输的消息提供合适的协议编码解码器
 * <p/>
 * <p><a href="BinaryCodecFactory.java.html"><i>View Source</i></a></p>
 *
 * @author <a href="mailto:afteryuan@afteryuan.com">$Author: yangc $</a>
 * @version $Revision: 1.1 $
 */
public class BinaryCodecFactory implements ProtocolCodecFactory {
    /**
     * 获得协议编码器
     * @param ioSession socket连接会话
     * @return ProtocolEncoder 合适的协议编码器
     * @throws Exception
     */
    public ProtocolEncoder getEncoder(IoSession ioSession) throws Exception {
        return new Amf3Encoder();
    }

    /**
     * 获得协议解码器
     * @param ioSession socket连接会话
     * @return ProtocolDecoder 合适的协议解码器
     * @throws Exception
     */
    public ProtocolDecoder getDecoder(IoSession ioSession) throws Exception {
        return new Amf3Decoder();
    }
}
